<?php

class Merit_pay_collection extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'Merit_pay_collection':
	 * @var integer $id
	 * @var string $plate_no
	 * @var string $driver_name
	 * @var string $type_name
	 * @var string $merit_pay_kind
	 * @var double $merit_pay
	 * @var double $merit_pay_ratio
	 * @var double $actual_salary
	 * @var string $stat_date
	 * @var integer $state
	 * @var string $create_time
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'merit_pay_collection';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('plate_no','length','max'=>10),
			array('driver_name','length','max'=>30),
			array('type_name','length','max'=>20),
			array('merit_pay_kind','length','max'=>10),
			array('state', 'numerical', 'integerOnly'=>true),
			array('merit_pay, merit_pay_ratio, actual_salary', 'numerical'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => '索引',
			'plate_no' => '车牌号',
			'driver_name' => '司机姓名',
			'type_name' => '车型',
			'profit' => '单车利润',
			'merit_pay_kind' => '档次',
			'merit_pay_sort' => '类别',
			'merit_pay' => '绩效工资',
			'merit_pay_ratio' => '核算系数',
			'actual_salary' => '实发工资',
			'stat_date' => '统计时间',
			'state' => '状态',
			'create_time' => '创建时间',
		);
	}
	
	public function excelAttributes(){//导出excel所需的字段名、列号、宽度
		return array(
			'plate_no'=>array('B',10),
			'driver_name'=>array('C',10),
			'type_name'=>array('D',17),
			'merit_pay_sort'=>array('E',10),
			'profit'=>array('F',10,'sum'=>true),
			'merit_pay_kind'=>array('G',10),
			'merit_pay'=>array('H',10,'sum'=>true),
			'merit_pay_ratio'=>array('I',10),
			'actual_salary'=>array('J',10,'sum'=>true),
			'stat_date'=>array('K',10),
		);
	}
}